<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>倒计时</title>
</head>
<script language=JavaScript>
var endtimes=new Array();//结束时间                  
var nowtimes;
function givetime(){
	nowtimes=new Date();//当前服务器时间
	window.setTimeout("DownCount()",1000)
}
function DownCount(){
    nowtimes = Number(nowtimes) + 1000;
	for (var i = 0; i < endtimes.length; i++)
	{
		var theDay=new Date(endtimes[i]);
		theDay=theDay++;
		if(theDay<=nowtimes)
		{
			document.getElementById("times"+i).innerHTML = "已结束";
		}
		else{
				timechange(theDay,i);
		}
	}
	window.setTimeout("DownCount()",1000)
}
function timechange(theDay,i){
	var theDays=new Date(theDay);
	var seconds = (theDays - nowtimes)/1000;
	var minutes = Math.floor(seconds/60);
	var hours = Math.floor(minutes/60);
	var days = Math.floor(hours/24);
	var CDay= days;
	var CHour= hours % 24;
	var CMinute= minutes % 60;
	var CSecond= Math.floor(seconds % 60);
	var CHour = CHour + CDay * 24;
	
	if(CMinute<10)
	{
		CMinute="0"+CMinute;
	}
	if(CHour<10)
	{
		CHour="0"+CHour;
	}
	if(CSecond<10)
	{
		CSecond="0"+CSecond;
	}
	document.getElementById("times" + i).innerHTML = CHour + "小时，" + CMinute + "分钟，" + CSecond + "秒" ;
}
function innerendtime(index, endtime) {
    endtimes[index] = endtime;
}
</script> 
<BODY> 
<table border="0" cellSpacing="0" cellPadding="0" width="100%" align="center" style="font-size:9pt">
<tr><td align="center">
距亚运会开幕还有：<div id="times0"></div>
<div id="times1"><script>innerendtime(0, '12/25/2011 19:53:35');</script></div>
<div id="times2"><script>innerendtime(1, '4/1/2011 13:53:02');</script></div>
<div id="times3"><script>innerendtime(2, '4/1/2011 19:23:24');</script></div>
</td></tr>
</table>
<script>    givetime();</script>
</body>
</html>